package com.zjt.mapper;

import com.zjt.po.User;
import com.zjt.vo.UserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    //1输入参数javaBean(添加方法)
    public void insertUser(User user);
    //2输入包装方法(添加方法)
    public void insertByUserVo(UserVo userVo);
    //3输入参数多个简单类型
    public void insertUserByParam(String userName,String description);
      //4输入参数多个简单类型2
    public void insertUserByParam2(@Param("name")String userName, @Param("description")String description);
    //5输入参数是多个javaBean
    public void insertUser2(User user1,User user2);
    //6输入参数是多个javaBean
    public void insertUser3(@Param("userOne") User user1,@Param("userTwo") User user2);
    //7输入映射map类型
    public void insertUserMap(Map map);

    //1.输出映射是简单类型:获得数据库记录数
    public int queryTotal();
    //2.输出映射javaBean类型
    public User queryUserById(int id);
    //3.输出映射为resultMap类型
    public User queryUserResultMapById(int id);

    //1.添加记录获得生成的id值
    public void insertUserReturnId(User user);


    //1.动态sqlif 查询用户信息根据用户名和描述信息
    public List<User> queryUsersLikeUserNameAndDescription(@Param("userName")String userName, @Param("description")String description);
    //2.动态sql choose when otherwise
    public List<User> queryUserByChooseNameOrDescription(@Param("par1") String par1,@Param("par2") String par2);
    //3.动态查询forEach
    public List<User> queryUsersByIds(List<Integer> ids);
}